package diona.snippet.requests

import diona.model.User
import diona.components.SnippetsUtil
import diona.search.SearchRequest
import net.liftweb.http.js.JsCmds

/**
 * User: anton
 * Date: 25.07.11 22:37
 */
object SearchRequests extends SnippetsUtil
{
  def list =
  {
    ".request_row" #> SearchRequest.getAll(User.currentUser.get).map(r =>
      ".request_row [onclick]" #> JsCmds.RedirectTo("/requests/searchResults?requestId=" + r.id).toJsCmd &
        ".request_row *" #> {
          ".query *" #> r.query &
          ".registration_date *" #> formatDate(r.registrationDate.get)
        }
    )
  }
}